/****
Program for: Conscription and Military Service: Do They Result in Violent 
and Non-Violent Incarcerations and Recidivism?

This program computes the bounds on LNATE, LMATE, ATE, LATE 
1948-1952 white and nonwhite in the pooled survey year.

03/16/2020
***/ 
capture log close
***Install package: Distinct 
ssc inst distinct

*****Please replace here with the directory folder
cd "C:\Users\xinto\Dropbox\Vietnam Veteran Paper\Crime Paper\2020RevisionDataSet\Bootstrap Folder\4850 birth cohort_03172020"

set more off
clear all
set memory 350m
set matsize 1000

program drop _all

global outcomes = "currentViolent"
global race4852= "0 1"

use pop_sample_03162020, clear 

keep weight yob Census birthYear white study id total_male_inmate /// 
birthMonth birthDay lott totalSample currentViolent nonviolent nonviolent_new vv eligible /// 
contactJuvenile violent_desistance nonviolent_desistance violent_r_draft nonviolent_r_draft ///
violent_drug_draft nonviolent_drug_draft ygroup* birth monthPop drawingYear APNheight ///
seasonYear seasonPop seasonYear_group seasonYear_group* monthYear_group monthYear_group* inmate /// 
fe_yob* fe_mob* fe_yobmob* yobmob lindo criminal violent nonviolent /// 
mob dob birth ygroup* fe_yob* yobmob fe_mob* drawingYear induction yobRSNID ///
relativeLotteryNumber relLotNumInteract relLotNumSquared relLotNumSqInter yeargroup ///
relLotNumCubed  relLotNumCuInter staylength yob lotteryNumber white study surveyyear LScurrentViolent LSnonviolent ///
LSviolent_desistance LSnonviolent_desistance LSviolent_r_draft LSnonviolent_r_draft LSviolent_drug_draft LSnonviolent_drug_draft ///
EvercurrentViolent Evernonviolent Everviolent_desistance Evernonviolent_desistance Everviolent_r_draft Evernonviolent_r_draft ///
 Everviolent_drug_draft Evernonviolent_drug_draft survey1 survey2 survey3 

qui do I2_pop_test_be_0804
qui do I2_pop_test_racial_be_0804

log using 4852_alternative_crime_definitions_log, text replace


foreach crime_outcome in $outcomes{

global outcome1="`crime_outcome'"

I2_pop_test_be

*Step 8: bootstrapping (uncomment to run the bootstrap)
   *bootstrap _b, r(2500) str(Census) saving(vc_`crime_outcome'_ygroup2_white_nonwhite_test_I2_be.dta, double replace) seed(1989): I2_pop_test_be 
   display("program finished running")
   
   }
   
log close   
